package com.arknights.web.dao;

import com.arknights.web.domain.User;
import com.arknights.web.util.JDBCUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.Connection;

public class UserDapImp implements UserDao {
    @Override
    public User getuser(String u_name) {
        String sql = "select * from user where u_name = ?";
        QueryRunner qr = new QueryRunner(JDBCUtil.getDs());
        User user = null;
        try {
            user = qr.query(sql,new BeanHandler<User>(User.class),u_name);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return user;
    }
}
